<?php
include_once '../business/market_manager.php';
include_once '../entity/market_entity.php';

$marketUpdate = New MarketMng();
$marketEntity = New MarketEntity();

$marketEntity->id         = $_POST[id];
$marketEntity->market     = $_POST[market];
$marketEntity->parentID   = $_POST[parentID];
$marketEntity->inTime     = $_POST[inTime];
$marketEntity->inUser     = $_POST[inUser];

if($marketUpdate->update($marketEntity)){
    if($_POST[id] == -1){
        echo "<script>alert('Add successful!')</script>";
    }else{
        echo "<script>alert('update successful!')</script>";
    }
    echo "<script>window.location='marketList.php?page=$_POST[page]'</script>";
}

?>
